// pages/hyk/index.js
var utils = require('../../utils/util.js');
var pageIndex = 1,
    filterIndex = 1,
    condition = false,
    is_slide = true;
Page({

  /**
   * 页面的初始数据
   */
  data: {
      scroll_h:50,
      list_data:[],
      allGoodsFilte:[],
      slide_is_hide:true,
      province:[],
      city:[]
  },
    reset_but:function(e){
        console.log(e);
        var province = this.data.province,
            city = this.data.city;
        for(var i=0;i<province.length;i++){
            province[i].checked = false;
        }
        for(var i=0;i<city.length;i++){
            city[i].checked = false;
        }
        is_slide = true;
        pageIndex = 1;
        filterIndex = 1;
        this.setData({
            province:province,
            city:city
        })
    },
    slide_ce:function(){    //显示隐藏
        /* console.log(111);*/
        console.log('click_slide');
        if(this.data.slide_is_hide == true){
            var bl = false;
        }else{
            var bl = true;
        }

        this.setData({
            slide_is_hide:bl
        });
    },
    formSubmit:function(e){   //提交
        console.log(e.detail.value);
        var param = e.detail.value;
        param.pageNo=filterIndex;
        var that =this;
        console.log(param);
        wx.request({
            url: 'https://www.ggd4.cn/wap/projectMeeting/getData',
            data: param,
            header: {
                'content-type': 'application/json' // 默认值
            },
            success: function(res) {
                console.log(res.data);
                condition = param;
                utils.submit_cg(that,res)
            }
        });
        console.log('form发生了submit事件，携带数据为：', e.detail.value);
    },
    province_get:function(e){
      var that = this;
        wx.request({
            url: 'https://www.ggd4.cn/wap/projectMeeting/getChildren',
            data: {
                id: e.detail.value
            },
            header: {
                'content-type': 'application/json' // 默认值
            },
            success: function(res) {
                console.log(res);
                that.setData({
                    city:res.data.data
                })
            }
        });
      console.log(e.detail.value);
        this.setData({
            province: utils.radio('province',this,e)
        })
    },
    city_get:function(e){
        this.setData({
            city: utils.radio('city',this,e)
        })
    },
    serviceValChange: function (e) {    //阶段依赖

        this.setData({
            allGoodsFilte: utils.radio('allGoodsFilte',this,e)
        })
    },
    gnbk_fun:function(e){      //概念板块
        this.setData({
            gnbk: utils.radio('gnbk',this,e)
        })
    },
    grade_fun:function(e){      //评分板块
        console.log(utils.radio('grade',this,e));
        this.setData({
            grade: utils.radio('grade',this,e)
        })
    },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      var that = this;
      utils.init_h(that);
      wx.request({
          url: 'https://www.ggd4.cn/wap/projectMeeting/getData',
          data: {
              pageNo: 1
          },
          header: {
              'content-type': 'application/json;' // 默认值
          },
          success: function(res) {
              console.log(res.data.data);
              that.setData({
                  list_data:res.data.data
              });
          }
      })
      wx.request({
          url: 'https://www.ggd4.cn/wap/projectMeeting/index',
          header: {
              'content-type': 'application/json;' // 默认值
          },
          success: function(res) {
              console.log(res.data.data);
              that.setData({
                  province:res.data.data
              });
          }
      })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  utils.onready(this);
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})